package com.smallstep.hystrix.config;


import com.smallstep.hystrix.exceptions.FallbackIgnore;
import com.smallstep.hystrix.exceptions.IFallbackIgnore;
import com.smallstep.hystrix.utils.ApplicationContextUtil;
import com.smallstep.hystrix.utils.FFHystrixFallbackUtil;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author 李俊
 */
public class HystrixConfig {

    @Bean
    public ApplicationContextUtil applicationContextUtil() {
        return new ApplicationContextUtil();
    }

    @Bean
    public FFHystrixFallbackUtil ffHystrixFallbackUtil() {
        return new FFHystrixFallbackUtil();
    }

    @ConditionalOnMissingBean(IFallbackIgnore.class)
    @Bean
    public IFallbackIgnore fallbackIgnore() {
        return new FallbackIgnore();
    }
}
